package math.petrinets.octave;

import org.junit.*;

import org.junit.Before;
import org.junit.Test;

public class OctaveUtilsTest {

    private OctaveUtils utils;

    @Before
    public void setUp() {
	utils = new OctaveUtils();
    }

    @Test
    public void multiplyMatrixByMatrixTest() {
	int[][] m1 = new int[][] { { 1, 2 }, { 3, 6 } };
	int[][] m2 = new int[][] { { 5, 1 }, { 5, 3 } };
	int[][] result = utils.multiplyMatrixByMatrix("a", m1, "b", m2);
	Assert.assertNotNull(result);
	Assert.assertEquals(2, result.length);
	Assert.assertEquals(2, result[0].length);
    }

    @Test(expected = IllegalArgumentException.class)
    public void multiplyMatrixByMatrixUncompatibleTest() {
	int[][] m1 = new int[][] { { 1, 2 }, { 3, 6 } };
	int[][] m2 = new int[][] { { 5, 1 }, { 5, 3 }, { 6, 2 } };
	int[][] result = utils.multiplyMatrixByMatrix("a", m1, "b", m2);
    }

}
